﻿using University.Workshop.Business;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using University.Workshop.Model;

namespace University.Workshop.Tests
{
    [TestClass()]
    public class LogOnBusinessTest
    {


        private TestContext testContextInstance;

      
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        [TestMethod()]
        [ExpectedException(typeof(BusinessException))]
        public void AuthenticationFailed()
        {
            LogOnBusiness aux = new LogOnBusiness();
            string userName = "pepito"; 
            string password = "asdfadsg"; 
            UserLogOn actual;
            actual = aux.Authentication(userName, password);
        }
        [TestMethod()]
        public void AuthenticationNotFail()
        {
            LogOnBusiness aux = new LogOnBusiness();
            string userName = "1";
            string password = "123";
            UserLogOn actual;
            actual = aux.Authentication(userName, password);
            Assert.AreNotEqual(null, actual);
        }
        [TestMethod()]
        [ExpectedException(typeof(BusinessException))]
        public void AuthenticationAccountEmpty()
        {
            LogOnBusiness aux = new LogOnBusiness();
            string userName = string.Empty;
            string password = "123";
            UserLogOn actual;
            actual = aux.Authentication(userName, password);
        }
        [TestMethod()]
        [ExpectedException(typeof(BusinessException))]
        public void AuthenticationPasswordEmpty()
        {
            LogOnBusiness aux = new LogOnBusiness();
            string userName = "1";
            string password = string.Empty;
            UserLogOn actual;
            actual = aux.Authentication(userName, password);
        }
        [TestMethod()]
        [ExpectedException(typeof(BusinessException))]
        public void AuthenticationAccountInvalidCharacter()
        {
            LogOnBusiness aux = new LogOnBusiness();
            string userName = "pepito_";
            string password = "asdfadsg"; 
            UserLogOn actual;
            actual = aux.Authentication(userName, password);
        }
        [TestMethod()]
        [ExpectedException(typeof(BusinessException))]
        public void AuthenticationPasswordInvalidCharacter()
        {
            LogOnBusiness aux = new LogOnBusiness();
            string userName = "pepito";
            string password = "asdfadsg_"; 
            UserLogOn actual;
            actual = aux.Authentication(userName, password);
        }
    }
}